package leetcode.all;

import java.util.HashSet;

public class Solution575 {
    public int distributeCandies(int[] candyType) {
        //统计糖果种类type和数量num，如果type<=num/2，那最多分的type类，否则最多num/2类
        int num = candyType.length/2;
        HashSet<Integer> typeSet = new HashSet<>();
        for (int t:candyType) {
            typeSet.add(t);
        }
        int type = typeSet.size();
        return Math.min(num,type);
    }
}
